package test;

public class Verif {
	static int n=4; 
	static double R=1; 
	static double omega=3*R; 
	static double radius=R;
	static double sinus=R*Math.sin(Math.PI/n); 
	static double petitR=R*sinus/(1+sinus);
	static double rCentral=R-2*petitR; 
	public static double inverse(double x){
		return omega+R*R/(x-omega); 
	}
	
	private static class couple{
		double x,y; 
		couple(double a, double b){
			this.x=a; 
			this.y=b; 
		}
		public String toString(){
			return x+" "+y; 
		}
		

	}
	
	public static couple inverser(couple c){
		double x=c.x; 
		double y=c.y; 
		double xp=omega+R*R*(x-omega)/((x-omega)*(x-omega)+y*y); 
		double yp=R*R*y/((x-omega)*(x-omega)+y*y); 
		return new couple(xp,yp);
	}
	
	public static void main(String[] args) {
		
		double A1=inverse(-R); 
		double A2=inverse(R); 
		double B1=inverse(-rCentral); 
		double B2=inverse(rCentral); 
		double gd=0.5*Math.abs(A2-A1); 
		double pd=0.5*Math.abs(B2-B1); 
		double coefA=0.5*(gd+pd); 
		double coefMu=0.5*(gd-pd); 
		double gc=0.5*(A1+A2);
		double pc=0.5*(B1+B2);
		double coefC=0.5*Math.abs(gc-pc); 
		System.out.println("Coefficients de la cyclide"); 
		System.out.println(coefA+" "+coefMu+" "+coefC); 
		double centre=0.5*(gc+pc);
		System.out.println("Centre "+centre); 
		
		System.out.println(A1+" "+A2);
		System.out.println(B1+" "+B2); 
		System.out.println(); 
		
		for(int i=0;i<n;i++){
			System.out.println(i); 
			couple interne=new couple(rCentral*Math.cos(2*i*Math.PI/n),rCentral*Math.sin(2*i*Math.PI/n));
			couple imInterne=inverser(interne); 
			System.out.println(imInterne);
			couple externe=new couple(R*Math.cos(2*i*Math.PI/n),R*Math.sin(2*i*Math.PI/n));
			couple imExterne=inverser(externe); 
			System.out.println(imExterne); 
		}
		
		
	}

}
